package com.manage.common.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public class OrderCodeGenerator {
    //自增长序列变量
    private int i = 0;

    //按照"年-月-日-时-分-秒-自增长序列"的规则生成订单编号
    public String getOrderCode(){
        Date now = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss-");
        return sdf.format(now) + ++i;
    }

    //按照"年-月-日-自增长序列"的规则生成账号
    public String getAccount(){
        Date now = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-");
        return sdf.format(now) + ++i;
    }
}
